<?php
namespace App\JdService;
/**
 * Created by PhpStorm.
 * User: laodage
 * Date: 19-1-17
 * Time: 下午3:13
 */
class jdToken extends jdService
{

    public function run($data){
        $Db = $this->getDb();
        $json = $data['token'];
        $data = json_decode($json,true);
        if(empty($data)){
            return true;
        }
        $insert = [

            'shopid' => (empty($data['venderId'])) ? '' : $data['venderId'],
            'jd_uid' => (empty($data['uid'])) ? '' : $data['uid'],
            'token' => (empty($data['token'])) ? '' : $data['token'],
            'expires' => (empty($data['expires_in'])) ? '' : $data['expires_in'],
            'time' => (empty($data['time'])) ? '' : $data['time'],
            'user_nick' => (empty($data['user_nick'])) ? '' : $data['user_nick'],

        ];
        $Db->insert('jddj_user')->cols($insert)->query();
    }
}